package cn.sytton.taffecloud.service.system.controller;

import cn.sytton.taffecloud.common.api.service.RemoteFileService;
import cn.sytton.taffecloud.common.base.response.R;
import cn.sytton.taffecloud.common.base.security.LoginUser;
import cn.sytton.taffecloud.common.base.util.JsonUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashSet;
import java.util.List;

/**
 * 测试Openfeign调用
 *
 * @author skyrock
 */
@RestController
@RequestMapping("/test")
public class ApiTestController {
    @Resource
    private RemoteFileService remoteFileService;

    @GetMapping
    public String test(){
        LoginUser lu = new LoginUser();
        lu.setUserId("test");
        lu.setLoginTimeStamp(System.currentTimeMillis());
        lu.setUserRoles(new HashSet<>());

//        System.out.println("=========== aaa ==========");
//        R<TestModel> a = remoteFileService.remoteGetTest("aaa");
//        System.out.println(a);
//        System.out.println(JsonUtil.getString(a));
//        System.out.println(a.isSuccess());
//
//        System.out.println("=========== bbb ==========");
//        R<String> b = remoteFileService.remotePostTest("bbb");
//        System.out.println(b);
//        System.out.println(JsonUtil.getString(b));
//
//        System.out.println("=========== ccc ==========");
//        R<List<TestModel>> c = remoteFileService.remoteGetTestQuery("ccc", lu);
//        System.out.println(c);
//        System.out.println(JsonUtil.getString(c));
//
//        System.out.println("=========== ddd ==========");
//        R<Void> d = remoteFileService.remotePostTestBody("ddd", lu);
//        System.out.println(d);
//        System.out.println(JsonUtil.getString(d));

        return "调用成功";
    }
}
